<template>
  <div>
    <h1>Test</h1>
    <el-button @click="fn1">操作</el-button>
    <el-button @click="fn2">操作2</el-button>

    <el-button @click="fn3">调用接口</el-button>
  </div>
</template>

<script lang="ts" setup>
import storage from '@/utils/storage'
import request from '@/utils/request'

function fn1() {
  // storage.set('token', '123456', 7200)

  storage.set('key1', 'value1', 10)
}

function fn2() {
  // console.log(storage.isExpired('key1'))

  console.log(storage.isExpired('token'))
}

function fn3() {
  request({
    url: '/admin/base/sys/role/page',
    method: 'POST'
  }).then((resp) => {
    console.log('获取角色列表完成', resp)
  })

  request({
    url: '/admin/base/sys/menu/list',
    method: 'POST'
  }).then((resp) => {
    console.log('获取菜单列表完成', resp)
  })
}
</script>
